﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.VersionControl.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace TFhisto
{
    /// <summary>
    /// Represents a changeset
    /// </summary>
    public class ChangesetStub
    {
        /// <summary>
        /// The value of the field that this work item will be grouped by.
        /// 
        /// This will ONLY be filled if we grouping by
        /// </summary>
        public string GroupyByFieldValue
        { get; set; }

        /// <summary>
        /// Stores the list of all files in the changeset
        /// </summary>
        List<FileChangeInfo> _files = new List<FileChangeInfo>();

        /// <summary>
        /// Merges from other branches
        /// </summary>
        Dictionary<string, Changeset[]> _merges = new Dictionary<string, Changeset[]>();

        /// <summary>
        /// The Parent Branch of the Changeset
        /// WARNING: in multiple file context this information may be not relevant for each change, 
        /// if all the changes are not from the same branch
        /// </summary>
        public string Branch
        { get; set; }

        /// <summary>
        /// The ChangeType associated to the Change instance related to the file tracked
        /// </summary>
        public string ChangeToFile
        { get; set; }
        
        /// <summary>
        /// The changeset number
        /// </summary>
        public int ID
        { get; set; }
        
        /// <summary>
        /// The changeset comment
        /// </summary>
        public string Comment
        { get; set; }

        /// <summary>
        /// The changeset owner
        /// </summary>
        public string Owner
        { get; set; }

        /// <summary>
        /// The changeset date
        /// </summary>
        public DateTime CheckinDate
        { get; set; }

        /// <summary>
        /// The Workitems associated to the changeset
        /// </summary>
        public WorkItem[] WorkItems
        { get; set; }


        /// <summary>
        /// The list of all files that are part of the changeset
        /// </summary>
        public List<FileChangeInfo> Files
        {
            get
            {
                return _files;
            }
            set
            {
                _files = value;
            }
        }

        /// <summary>
        /// Merges from other branches
        /// </summary>
        Dictionary<string, Changeset[]> Merges
        {
            get
            {
                return _merges;
            }
            set
            {
                _merges = value;
            }
        }
    }
}
